﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;
using System.Collections.Generic;

namespace Jy123.Web.Friend
{

    public partial class SelFriendClass : System.Web.UI.Page
    {
        protected string selClass;
        protected int userID, reqID;
        protected void Page_Load(object sender, EventArgs e)
        {
            string strUserIdFromCookie = Common.Cookie.getCookie("UserID");
            if (string.IsNullOrEmpty(strUserIdFromCookie))
            {
                Response.Redirect("/");
            }
            userID = Convert.ToInt32(Request.QueryString["UserID"]);
            reqID = Convert.ToInt32(Request.QueryString["reqID"]);//请求的ID


            selClass = "<select name=\"fclass\" id=\"fclass\">{0}</select>";
            string option = "<option value=\"{0}\">{1}</option>";
            List<Model.User_FriendClass> mFrdClass = new Jy123.BLL.User_FriendClass().GetModelList("FUser='" + strUserIdFromCookie + "'");
            if (mFrdClass.Count == 0)
            {//加入默认好友分组??
                List<Model.User_FriendClass> mFrdClassDefault = new Jy123.BLL.User_FriendClass().GetModelList("FUser='0'");
                mFrdClass = mFrdClassDefault;
            }
            //加入默认好友分组??
            //Model.User_FriendClass mFrdClassDefault =new Jy123.Model.User_FriendClass();
            //mFrdClassDefault.FUser = userID;
            //mFrdClassDefault.CName = "默认分组";
            //mFrdClass.Insert(0, mFrdClassDefault);
            StringBuilder sbOption = new StringBuilder();
            foreach (Model.User_FriendClass fclass in mFrdClass)
            {
                sbOption.AppendFormat(option, fclass.ID, fclass.CName);
            }
            selClass = string.Format(selClass, sbOption.ToString());
        }
    }
}
